package com.oa.controller;

import com.oa.pojo.Result;
import com.oa.pojo.Vacation;
import com.oa.service.VacationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@Api(tags = "请假:在线接口")
@RestController
@RequestMapping("vacation")
public class VacationController {
    @Autowired
    private VacationService vacationService;

    @CrossOrigin
    @ApiOperation(value="根据id查询员工请假详情",httpMethod = "POST")
    @PostMapping("/selectAllByIdVacation")
    public Result selectAllByIdVacation(@RequestBody Vacation vacation){
        System.out.println("执行请假信息查询");
        List<Vacation> vacationList = new ArrayList<>();
        vacationList=vacationService.selectAllByIdVacations(vacation);
        if(vacationList !=null){
            return Result.success(vacationList);
        }else {
            return Result.error("结果为空");
        }
    }

}
